*------------------------------------------------------------------------------*
*																			   *
*				Time of Final Vote Decision: Time Ray						   *
*																			   *
*------------------------------------------------------------------------------*

clear
version 14
set more off


* a/1= 2009
* b/2 = 2013


input year wave_a1 wave_a2 wave_a3 wave_a4 wave_a5 wave_a6 wave_a7 ///
	wave_b1 wave_b2 wave_b3 wave_b4 wave_b5 wave_b6 wave_b7 str20 name ///
	first_rallies_a tv_debate_a closing_rallies_a first_rally_csu_b ///
	first_rally_spd_b tv_debate_b first_rallies_b first_rally_afd_b ///
	closing_rallies_b


1.2 . . . . . . . . . . . . . . "first rallies" -27 . . . . . . . .
1.2 . . . . . . . . . . . . . . "first rallies" -21 . . . . . . . .
1.2 . . . . . . . . . . . . . . "TV debate" . -14 . . . . . . .	
1.2 . . . . . . . . . . . . . . "closing rallies" . . -3 . . . . . .
1.2 . . . . . . . . . . . . . . "closing rallies" . . -1 . . . . . .

0.2 . . . . . . . . . . . . . . "first rally CSU" . . . -66 . . . . .
0.2 . . . . . . . . . . . . . . "first rally SPD" . . . . -36 . . . .
0.2 . . . . . . . . . . . . . . "TV debate" . . . . . -21 . . .
0.2 . . . . . . . . . . . . . . "first rallies" . . . . . . -17 . .
0.2 . . . . . . . . . . . . . . "first rallies" . . . . . . -13 . .
0.2 . . . . . . . . . . . . . . "first rally AfD" . . . . . . . -8 .
0.2 . . . . . . . . . . . . . . "closing rallies" . . . . . . . . -3
0.2 . . . . . . . . . . . . . . "closing rallies" . . . . . . . . -1

	
1 -79 . . . . . . . . . . . . . "wave1" . . . . . . . . .
1 -69 . . . . . . . . . . . . . . . . . . . . . . .
1 . -65 . . . . . . . . . . . . "wave2" . . . . . . . . .
1 . -56 . . . . . . . . . . . . . . . . . . . . . .
1 . . -51 . . . . . . . . . . . "wave3" . . . . . . . . .
1 . . -41 . . . . . . . . . . . . . . . . . . . . .
1 . . . -37 . . . . . . . . . . "wave4" . . . . . . . . .
1 . . . -27 . . . . . . . . . . . . . . . . . . . .
1 . . . . -23 . . . . . . . . . "wave5" . . . . . . . . .
1 . . . . -14 . . . . . . . . . . . . . . . . . . .
1 . . . . . -9 . . . . . . . . "wave6" . . . . . . . . .
1 . . . . . 0 . . . . . . . . . . . . . . . . . .
1 . . . . . . 2 . . . . . . . "wave7" . . . . . . . . .
1 . . . . . . 10 . . . . . . . . . . . . . . . . .


0 . . . . . . . -94 . . . . . . "wave1" . . . . . . . . .
0 . . . . . . . -77 . . . . . . . . . . . . . . . .
0 . . . . . . . . -66 . . . . . "wave2" . . . . . . . . .
0 . . . . . . . . -56 . . . . . . . . . . . . . . .
0 . . . . . . . . . -52 . . . . "wave3" . . . . . . . . .
0 . . . . . . . . . -42 . . . . .  . . . . . . . . .
0 . . . . . . . . . . -38 . . . "wave4" . . . . . . . . .
0 . . . . . . . . . . -28 . . . .  . . . . . . . . .
0 . . . . . . . . . . . -20 . . "wave5" . . . . . . . . .
0 . . . . . . . . . . . -10 . . . . . . . . . . . .
0 . . . . . . . . . . . . -6 . "wave6" . . . . . . . . .
0 . . . . . . . . . . . . -1 . . . . . . . . . . .
0 . . . . . . . . . . . . . 2  "wave7" . . . . . . . . .
0 . . . . . . . . . . . . . 10 . . . . . . . . . .
end


*browse

lab define year_lab 0 "2013" 1 "2009"
lab val year year_lab

fre year

* Figure
#delimit ;
twoway connected year wave_a1, msymbol(o) mcolor(gs3) lpattern(solid) lcolor(gs3)
		msize(large) lwidth(thick)
	|| connected year wave_a2, msymbol(o) mcolor(gs3) lpattern(solid) lcolor(gs3)
		msize(large) lwidth(thick)
	|| connected year wave_a3, msymbol(o) mcolor(gs3) lpattern(solid) lcolor(gs3)
		msize(large) lwidth(thick)
	|| connected year wave_a4, msymbol(o) mcolor(gs3) lpattern(solid) lcolor(gs3)
		msize(large) lwidth(thick)
	|| connected year wave_a5, msymbol(o) mcolor(gs3) lpattern(solid) lcolor(gs3)
		msize(large) lwidth(thick)
	|| connected year wave_a6, msymbol(o) mcolor(gs3) lpattern(solid) lcolor(gs3)
		msize(large) lwidth(thick)
	|| connected year wave_a7, msymbol(o) mcolor(gs3) lpattern(solid) lcolor(gs3)
		msize(large) lwidth(thick)		
	|| connected year wave_b1, msymbol(o) mcolor(gs3) lpattern(solid)
		msize(large) lwidth(thick)
	|| connected year wave_b2, msymbol(o) mcolor(gs3) lpattern(solid)
		msize(large) lwidth(thick)
	|| connected year wave_b3, msymbol(o) mcolor(gs3) lpattern(solid)
		msize(large) lwidth(thick)
	|| connected year wave_b4, msymbol(o) mcolor(gs3) lpattern(solid)
		msize(large) lwidth(thick)
	|| connected year wave_b5, msymbol(o) mcolor(black) lpattern(solid)
		msize(large) lwidth(thick)
	|| connected year wave_b6, msymbol(o) mcolor(gs3) lpattern(solid)
		msize(large) lwidth(thick)
	|| connected year wave_b7, msymbol(o) mcolor(gs3) lpattern(solid)
		msize(large) lwidth(thick)
	|| connected year first_rallies_a, msymbol(s) mcolor(gs3) lpattern(solid) lcolor(gs3)
		msize(large) lwidth(thick)
	|| connected year tv_debate_a, msymbol(s) mcolor(gs3) lpattern(solid) lcolor(gs3)
		msize(large) lwidth(thick)
	|| connected year closing_rallies_a, msymbol(s) mcolor(gs3) lpattern(solid) lcolor(gs3)
		msize(large) lwidth(thick)
	|| connected year first_rally_csu_b, msymbol(s) mcolor(gs3) lpattern(solid)
		msize(large) lwidth(thick)
	|| connected year first_rally_spd_b, msymbol(s) mcolor(gs3) lpattern(solid)
		msize(large) lwidth(thick)
	|| connected year tv_debate_b, msymbol(s) mcolor(gs3) lpattern(solid)
		msize(large) lwidth(thick)
	|| connected year first_rallies_b, msymbol(s) mcolor(gs3) lpattern(solid)
		msize(large) lwidth(thick)
	|| connected year first_rally_afd_b, msymbol(s) mcolor(gs3) lpattern(solid) 
		msize(large) lwidth(thick)
	|| connected year closing_rallies_b, msymbol(s) mcolor(gs3) lpattern(solid)
		msize(large) lwidth(thick) 
	
	text(0.9 -74 "wave 1" , color(gs3) place(6) justification(center))
	text(0.9 -60.5 "wave 2" , color(gs3) place(6) justification(center))
	text(0.9 -46 "wave 3" , color(gs3) place(6) justification(center))
	text(0.9 -32 "wave 4" , color(gs3) place(6) justification(center))
	text(0.9 -18.5 "wave 5" , color(gs3) place(6) justification(center))
	text(0.9 -4.5 "wave 6" , color(gs3) place(6) justification(center))
	text(0.9 6.5 "wave 7" , color(gs3) place(6) justification(center))
	text(-.1 -85.5 "wave 1" , place(6) justification(center))
	text(-.1 -61 "wave 2" , place(6) justification(center))
	text(-.1 -47 "wave 3" , place(6) justification(center))
	text(-.1 -33 "wave 4" , place(6) justification(center))
	text(-.1 -15 "wave 5" , place(6) justification(center))
	text(-.1 -3.5 "wave 6" , place(6) justification(center))
	text(-.1 7 "wave 7" , place(6) justification(center))
	
	text(1.3 -24 "first rallies" "SPD, FDP, Greens" "The Left, CDU/CSU", color(gs3) place(12) 
		justification(center) size(small))
	text(1.3 -14 "TV debate", color(gs3) place(12) justification(center)
		size(small))
	text(1.3 -2 "closing rallies", color(gs3) place(12) justification(center)
		size(small))
		
	text(0.3 -66 "first rally CSU", place(12) justification(center)
		size(small))
	text(0.3 -36 "first rally SPD", place(12) justification(center)
		size(small))
	text(0.3 -21.5 "TV" "debate", place(12) justification(center)
		size(small))	
	text(0.3 -15 "first rallies" "CDU, Greens," "FDP, The Left", place(12) justification(center)
		size(small))
	text(0.3 -8.3 "first rally" "AfD", place(12) justification(center)
		size(small))
	text(0.3 -2 "closing rallies", place(12) justification(center)
		size(small))
		
		
	text(1.4 -93 "2009", /*box*/ color(gs3) place(6) justification(right) size(medsmall)
		lcolor(gs3) fcolor(none) margin(tiny))
	text(0.4 -93 "2013", /*box*/ place(6) justification(right) size(medsmall)
		fcolor(none) margin(tiny))
	
	text(1.45 14 "{it:events}", /*box*/ color(gs3) place(6) justification(right) size(medsmall)
		lcolor(gs3) fcolor(none) margin(tiny))
	text(0.45 14 "{it:events}", /*box*/ place(6) justification(right) size(medsmall)
		fcolor(none) margin(tiny))
		
	text(0.9 14 "{it:survey}", /*box*/ color(gs3) place(6) justification(right) size(medsmall)
		lcolor(gs3) fcolor(none) margin(tiny))
	text(-0.1 14 "{it:survey}", /*box*/ place(6) justification(right) size(medsmall)
		fcolor(none) margin(tiny))
			
		
		
	scheme(sj) xsize(15) ysize(5) 
	/*title(Waves of GLES campaign panels 2009 & 2013, margin(vlarge))*/
	ytitle("") yline(0 1, lcolor(white)) 
	ylabel(0 1, nolab tlstyle(none))
	xtitle(Number of days until and after election day, margin(medium))
	xlabel(-91(7)17.21 0 "election day") aspectratio(0.1) plotregion(margin(b+5))
	legend(off) graphregion(color(white))
	/*xline(0)*/
	yaxis(2) 
	ytitle("",axis(2)) 
	ylabel(0 1.5, nolab tlstyle(none) axis(2))
	;
#delimit cr

graph export "${path}\Reproducible Do-Files\Chapter 1\Figure 1.tif", replace width(3000)
